package com.nulldev.util.uri;

import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.SocketAddress;

import com.nulldev.util.net.IPUtil;

public class nProxy extends Proxy {

	public nProxy(final Type type, final String ip, final int port) {
		super(type, new InetSocketAddress(ip, port));
	}
	
	public nProxy(final Type type, final SocketAddress sa) {
		super(type, sa);
	}
	
	public nProxy() {
		super(Type.DIRECT, null);
	}
	
	public boolean isWorking() {
		if (this.type() == Type.DIRECT) {
			return IPUtil.online();
		}else if (this.type() == Type.HTTP) {
			return IPUtil.online(this);
		}
		return false;
	}

}
